package com.gr.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gr.entity.Record;
import com.gr.entity.Student;
import com.gr.service.FeignService;
import com.gr.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author guoran
 * @since 2022-04-30
 */
@RestController
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private IStudentService iss;
    @Autowired
    private FeignService fs;
    @GetMapping("/selectAll")
    public List<Student> selectAll(){
        return iss.list();
    }

    @GetMapping("/selectByPage")
    public IPage<Student> selectByPage(Page page){
        return iss.page(page);
    }

    @GetMapping("/record/selectByStuId/{stuId}")
    public List<Record> selectByStuId(@PathVariable("stuId") int stuId){
        return fs.selectByStuId(stuId);
    }

}

